home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / DatabaseAccess.a < prev    next >
Text File  |  1996-05-01  |  11KB  |  444 lines

  1. ;
  2. ;    File:        DatabaseAccess.a
  3. ;
  4. ;    Contains:    Database Access Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__DATABASEACCESS__') = 'UNDEFINED' THEN
  19. __DATABASEACCESS__ SET 1
  20.  
  21.     IF &TYPE('__RESOURCES__') = 'UNDEFINED' THEN
  22.     include 'Resources.a'
  23.     ENDIF
  24.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  25. ;  data type codes 
  26.  
  27. typeNone                        EQU        'none'
  28. typeDate                        EQU        'date'
  29. typeTime                        EQU        'time'
  30. typeTimeStamp                    EQU        'tims'
  31. typeDecimal                        EQU        'deci'
  32. typeMoney                        EQU        'mone'
  33. typeVChar                        EQU        'vcha'
  34. typeVBin                        EQU        'vbin'
  35. typeLChar                        EQU        'lcha'
  36. typeLBin                        EQU        'lbin'
  37. typeDiscard                        EQU        'disc'                ; "dummy" types for DBResultsToText 
  38. typeUnknown                        EQU        'unkn'
  39. typeColBreak                    EQU        'colb'
  40. typeRowBreak                    EQU        'rowb'                ; pass this in to DBGetItem for any data type 
  41. typeAnyType                        EQU        0
  42. ;  infinite timeout value for DBGetItem 
  43.  
  44.                                                             ; messages for status functions for DBStartQuery 
  45. kDBUpdateWind                    EQU        0
  46. kDBAboutToInit                    EQU        1
  47. kDBInitComplete                    EQU        2
  48. kDBSendComplete                    EQU        3
  49. kDBExecComplete                    EQU        4
  50. kDBStartQueryComplete            EQU        5
  51.  
  52.                                                             ; messages for status functions for DBGetQueryResults 
  53. kDBGetItemComplete                EQU        6
  54. kDBGetQueryResultsComplete        EQU        7
  55. kDBWaitForever                    EQU        -1                    ;  flags for DBGetItem  
  56. kDBLastColFlag                    EQU        $0001
  57. kDBNullFlag                        EQU        $0004
  58. ; typedef OSType                         DBType
  59.  
  60.  
  61.  
  62. ; typedef DBAsyncParamBlockRec *        DBAsyncParmBlkPtr
  63.  
  64. ;  structure for asynchronous parameter block 
  65. DBAsyncParamBlockRec    RECORD 0
  66. completionProc             ds.l    1                ; offset: $0 (0)        ;  pointer to completion routine 
  67. result                     ds.w    1                ; offset: $4 (4)        ;  result of call 
  68. userRef                     ds.l    1                ; offset: $6 (6)        ;  for application's use 
  69. ddevRef                     ds.l    1                ; offset: $A (10)        ;  for ddev's use 
  70. reserved                 ds.l    1                ; offset: $E (14)        ;  for internal use 
  71. sizeof                     EQU *                    ; size:   $12 (18)
  72.                         ENDR
  73. ;  structure for resource list in QueryRecord 
  74. ResListElem                RECORD 0
  75. theType                     ds.l    1                ; offset: $0 (0)        ;  resource type 
  76. id                         ds.w    1                ; offset: $4 (4)        ;  resource id 
  77. sizeof                     EQU *                    ; size:   $6 (6)
  78.                         ENDR
  79. ; typedef struct ResListElem *            ResListPtr
  80.  
  81. ; typedef ResListPtr *                    ResListHandle
  82.  
  83. ;  structure for query list in QueryRecord 
  84. QueryArray                RECORD 0
  85. elements                 ds.l    256
  86. sizeof                     EQU *                    ; size:   $400 (1024)
  87.                         ENDR
  88.  
  89.  
  90. QueryRecord                RECORD 0
  91. version                     ds.w    1                ; offset: $0 (0)        ;  version 
  92. id                         ds.w    1                ; offset: $2 (2)        ;  id of 'qrsc' this came from 
  93. queryProc                 ds.l    1                ; offset: $4 (4)        ;  handle to query def proc 
  94. ddevName                 ds        Str63            ; offset: $8 (8)        ;  ddev name 
  95. host                     ds        Str255            ; offset: $48 (72)        ;  host name 
  96. user                     ds        Str255            ; offset: $148 (328)    ;  user name 
  97. password                 ds        Str255            ; offset: $248 (584)    ;  password 
  98. connStr                     ds        Str255            ; offset: $348 (840)    ;  connection string 
  99. currQuery                 ds.w    1                ; offset: $448 (1096)    ;  index of current query 
  100. numQueries                 ds.w    1                ; offset: $44A (1098)    ;  number of queries in list 
  101. queryList                 ds.l    1                ; offset: $44C (1100)    ;  handle to array of handles to text 
  102. numRes                     ds.w    1                ; offset: $450 (1104)    ;  number of resources in list 
  103. resList                     ds.l    1                ; offset: $452 (1106)    ;  handle to array of resource list elements 
  104. dataHandle                 ds.l    1                ; offset: $456 (1110)    ;  for use by query def proc 
  105. refCon                     ds.l    1                ; offset: $45A (1114)    ;  for use by application 
  106. sizeof                     EQU *                    ; size:   $45E (1118)
  107.                         ENDR
  108. ; typedef struct QueryRecord *            QueryPtr
  109.  
  110. ; typedef QueryPtr *                    QueryHandle
  111.  
  112. ;  structure of column types array in ResultsRecord 
  113. ColTypesArray            RECORD 0
  114. elements                 ds.l    256
  115. sizeof                     EQU *                    ; size:   $400 (1024)
  116.                         ENDR
  117.  
  118.  
  119. ;  structure for column info in ResultsRecord 
  120. DBColInfoRecord            RECORD 0
  121. len                         ds.w    1                ; offset: $0 (0)
  122. places                     ds.w    1                ; offset: $2 (2)
  123. flags                     ds.w    1                ; offset: $4 (4)
  124. sizeof                     EQU *                    ; size:   $6 (6)
  125.                         ENDR
  126. ColInfoArray            RECORD 0
  127. elements                 ds.b    256 * DBColInfoRecord.sizeof
  128. sizeof                     EQU *                    ; size:   $600 (1536)
  129.                         ENDR
  130.  
  131.  
  132. ;  structure of results returned by DBGetResults 
  133. ResultsRecord            RECORD 0
  134. numRows                     ds.w    1                ; offset: $0 (0)        ;  number of rows in result 
  135. numCols                     ds.w    1                ; offset: $2 (2)        ;  number of columns per row 
  136. colTypes                 ds.l    1                ; offset: $4 (4)        ;  data type array 
  137. colData                     ds.l    1                ; offset: $8 (8)        ;  actual results 
  138. colInfo                     ds.l    1                ; offset: $C (12)        ;  DBColInfoRecord array 
  139. sizeof                     EQU *                    ; size:   $10 (16)
  140.                         ENDR
  141. ;
  142. ; pascal OSErr InitDBPack(void )
  143. ;
  144.     IF ¨ GENERATINGCFM THEN
  145.         Macro
  146.         _InitDBPack
  147.             move.w              #$0004,-(sp)
  148.             move.w              #$0100,D0
  149.             dc.w                $A82F
  150.         EndM
  151.     ELSE
  152.         IMPORT_CFM_FUNCTION InitDBPack
  153.     ENDIF
  154.  
  155. ;
  156. ; pascal OSErr DBInit(long *sessID, ConstStr63Param ddevName, ConstStr255Param host, ConstStr255Param user, ConstStr255Param passwd, ConstStr255Param connStr, DBAsyncParmBlkPtr asyncPB)
  157. ;
  158.     IF ¨ GENERATINGCFM THEN
  159.         Macro
  160.         _DBInit
  161.             move.w              #$0E02,D0
  162.             dc.w                $A82F
  163.         EndM
  164.     ELSE
  165.         IMPORT_CFM_FUNCTION DBInit
  166.     ENDIF
  167.  
  168. ;
  169. ; pascal OSErr DBEnd(long sessID, DBAsyncParmBlkPtr asyncPB)
  170. ;
  171.     IF ¨ GENERATINGCFM THEN
  172.         Macro
  173.         _DBEnd
  174.             move.w              #$0403,D0
  175.             dc.w                $A82F
  176.         EndM
  177.     ELSE
  178.         IMPORT_CFM_FUNCTION DBEnd
  179.     ENDIF
  180.  
  181. ;
  182. ; pascal OSErr DBGetConnInfo(long sessID, short sessNum, long *returnedID, long *version, Str63 ddevName, Str255 host, Str255 user, Str255 network, Str255 connStr, long *start, OSErr *state, DBAsyncParmBlkPtr asyncPB)
  183. ;
  184.     IF ¨ GENERATINGCFM THEN
  185.         Macro
  186.         _DBGetConnInfo
  187.             move.w              #$1704,D0
  188.             dc.w                $A82F
  189.         EndM
  190.     ELSE
  191.         IMPORT_CFM_FUNCTION DBGetConnInfo
  192.     ENDIF
  193.  
  194. ;
  195. ; pascal OSErr DBGetSessionNum(long sessID, short *sessNum, DBAsyncParmBlkPtr asyncPB)
  196. ;
  197.     IF ¨ GENERATINGCFM THEN
  198.         Macro
  199.         _DBGetSessionNum
  200.             move.w              #$0605,D0
  201.             dc.w                $A82F
  202.         EndM
  203.     ELSE
  204.         IMPORT_CFM_FUNCTION DBGetSessionNum
  205.     ENDIF
  206.  
  207. ;
  208. ; pascal OSErr DBSend(long sessID, Ptr text, short len, DBAsyncParmBlkPtr asyncPB)
  209. ;
  210.     IF ¨ GENERATINGCFM THEN
  211.         Macro
  212.         _DBSend
  213.             move.w              #$0706,D0
  214.             dc.w                $A82F
  215.         EndM
  216.     ELSE
  217.         IMPORT_CFM_FUNCTION DBSend
  218.     ENDIF
  219.  
  220. ;
  221. ; pascal OSErr DBSendItem(long sessID, DBType dataType, short len, short places, short flags, void *buffer, DBAsyncParmBlkPtr asyncPB)
  222. ;
  223.     IF ¨ GENERATINGCFM THEN
  224.         Macro
  225.         _DBSendItem
  226.             move.w              #$0B07,D0
  227.             dc.w                $A82F
  228.         EndM
  229.     ELSE
  230.         IMPORT_CFM_FUNCTION DBSendItem
  231.     ENDIF
  232.  
  233. ;
  234. ; pascal OSErr DBExec(long sessID, DBAsyncParmBlkPtr asyncPB)
  235. ;
  236.     IF ¨ GENERATINGCFM THEN
  237.         Macro
  238.         _DBExec
  239.             move.w              #$0408,D0
  240.             dc.w                $A82F
  241.         EndM
  242.     ELSE
  243.         IMPORT_CFM_FUNCTION DBExec
  244.     ENDIF
  245.  
  246. ;
  247. ; pascal OSErr DBState(long sessID, DBAsyncParmBlkPtr asyncPB)
  248. ;
  249.     IF ¨ GENERATINGCFM THEN
  250.         Macro
  251.         _DBState
  252.             move.w              #$0409,D0
  253.             dc.w                $A82F
  254.         EndM
  255.     ELSE
  256.         IMPORT_CFM_FUNCTION DBState
  257.     ENDIF
  258.  
  259. ;
  260. ; pascal OSErr DBGetErr(long sessID, long *err1, long *err2, Str255 item1, Str255 item2, Str255 errorMsg, DBAsyncParmBlkPtr asyncPB)
  261. ;
  262.     IF ¨ GENERATINGCFM THEN
  263.         Macro
  264.         _DBGetErr
  265.             move.w              #$0E0A,D0
  266.             dc.w                $A82F
  267.         EndM
  268.     ELSE
  269.         IMPORT_CFM_FUNCTION DBGetErr
  270.     ENDIF
  271.  
  272. ;
  273. ; pascal OSErr DBBreak(long sessID, Boolean abort, DBAsyncParmBlkPtr asyncPB)
  274. ;
  275.     IF ¨ GENERATINGCFM THEN
  276.         Macro
  277.         _DBBreak
  278.             move.w              #$050B,D0
  279.             dc.w                $A82F
  280.         EndM
  281.     ELSE
  282.         IMPORT_CFM_FUNCTION DBBreak
  283.     ENDIF
  284.  
  285. ;
  286. ; pascal OSErr DBGetItem(long sessID, long timeout, DBType *dataType, short *len, short *places, short *flags, void *buffer, DBAsyncParmBlkPtr asyncPB)
  287. ;
  288.     IF ¨ GENERATINGCFM THEN
  289.         Macro
  290.         _DBGetItem
  291.             move.w              #$100C,D0
  292.             dc.w                $A82F
  293.         EndM
  294.     ELSE
  295.         IMPORT_CFM_FUNCTION DBGetItem
  296.     ENDIF
  297.  
  298. ;
  299. ; pascal OSErr DBUnGetItem(long sessID, DBAsyncParmBlkPtr asyncPB)
  300. ;
  301.     IF ¨ GENERATINGCFM THEN
  302.         Macro
  303.         _DBUnGetItem
  304.             move.w              #$040D,D0
  305.             dc.w                $A82F
  306.         EndM
  307.     ELSE
  308.         IMPORT_CFM_FUNCTION DBUnGetItem
  309.     ENDIF
  310.  
  311. ;
  312. ; pascal OSErr DBKill(DBAsyncParmBlkPtr asyncPB)
  313. ;
  314.     IF ¨ GENERATINGCFM THEN
  315.         Macro
  316.         _DBKill
  317.             move.w              #$020E,D0
  318.             dc.w                $A82F
  319.         EndM
  320.     ELSE
  321.         IMPORT_CFM_FUNCTION DBKill
  322.     ENDIF
  323.  
  324. ;
  325. ; pascal OSErr DBGetNewQuery(short queryID, QueryHandle *query)
  326. ;
  327.     IF ¨ GENERATINGCFM THEN
  328.         Macro
  329.         _DBGetNewQuery
  330.             move.w              #$030F,D0
  331.             dc.w                $A82F
  332.         EndM
  333.     ELSE
  334.         IMPORT_CFM_FUNCTION DBGetNewQuery
  335.     ENDIF
  336.  
  337. ;
  338. ; pascal OSErr DBDisposeQuery(QueryHandle query)
  339. ;
  340.     IF ¨ GENERATINGCFM THEN
  341.         Macro
  342.         _DBDisposeQuery
  343.             move.w              #$0210,D0
  344.             dc.w                $A82F
  345.         EndM
  346.     ELSE
  347.         IMPORT_CFM_FUNCTION DBDisposeQuery
  348.     ENDIF
  349.  
  350. ;
  351. ; pascal OSErr DBStartQuery(long *sessID, QueryHandle query, DBStatusUPP statusProc, DBAsyncParmBlkPtr asyncPB)
  352. ;
  353.     IF ¨ GENERATINGCFM THEN
  354.         Macro
  355.         _DBStartQuery
  356.             move.w              #$0811,D0
  357.             dc.w                $A82F
  358.         EndM
  359.     ELSE
  360.         IMPORT_CFM_FUNCTION DBStartQuery
  361.     ENDIF
  362.  
  363. ;
  364. ; pascal OSErr DBGetQueryResults(long sessID, ResultsRecord *results, long timeout, DBStatusUPP statusProc, DBAsyncParmBlkPtr asyncPB)
  365. ;
  366.     IF ¨ GENERATINGCFM THEN
  367.         Macro
  368.         _DBGetQueryResults
  369.             move.w              #$0A12,D0
  370.             dc.w                $A82F
  371.         EndM
  372.     ELSE
  373.         IMPORT_CFM_FUNCTION DBGetQueryResults
  374.     ENDIF
  375.  
  376. ;
  377. ; pascal OSErr DBResultsToText(ResultsRecord *results, Handle *theText)
  378. ;
  379.     IF ¨ GENERATINGCFM THEN
  380.         Macro
  381.         _DBResultsToText
  382.             move.w              #$0413,D0
  383.             dc.w                $A82F
  384.         EndM
  385.     ELSE
  386.         IMPORT_CFM_FUNCTION DBResultsToText
  387.     ENDIF
  388.  
  389. ;
  390. ; pascal OSErr DBInstallResultHandler(DBType dataType, DBResultHandlerUPP theHandler, Boolean isSysHandler)
  391. ;
  392.     IF ¨ GENERATINGCFM THEN
  393.         Macro
  394.         _DBInstallResultHandler
  395.             move.w              #$0514,D0
  396.             dc.w                $A82F
  397.         EndM
  398.     ELSE
  399.         IMPORT_CFM_FUNCTION DBInstallResultHandler
  400.     ENDIF
  401.  
  402. ;
  403. ; pascal OSErr DBRemoveResultHandler(DBType dataType)
  404. ;
  405.     IF ¨ GENERATINGCFM THEN
  406.         Macro
  407.         _DBRemoveResultHandler
  408.             move.w              #$0215,D0
  409.             dc.w                $A82F
  410.         EndM
  411.     ELSE
  412.         IMPORT_CFM_FUNCTION DBRemoveResultHandler
  413.     ENDIF
  414.  
  415. ;
  416. ; pascal OSErr DBGetResultHandler(DBType dataType, DBResultHandlerUPP *theHandler, Boolean getSysHandler)
  417. ;
  418.     IF ¨ GENERATINGCFM THEN
  419.         Macro
  420.         _DBGetResultHandler
  421.             move.w              #$0516,D0
  422.             dc.w                $A82F
  423.         EndM
  424.     ELSE
  425.         IMPORT_CFM_FUNCTION DBGetResultHandler
  426.     ENDIF
  427.  
  428. ;
  429. ; pascal OSErr DBIdle(void )
  430. ;
  431.     IF ¨ GENERATINGCFM THEN
  432.         Macro
  433.         _DBIdle
  434.             move.w              #$00FF,D0
  435.             dc.w                $A82F
  436.         EndM
  437.     ELSE
  438.         IMPORT_CFM_FUNCTION DBIdle
  439.     ENDIF
  440.  
  441.     ENDIF
  442.     ENDIF ; __DATABASEACCESS__ 
  443.  
  444.